package src.stu23002120.chapter07;

import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;

public class Demolichao19 {public static void main(String[] args) {
    Map map_23002120 = new TreeMap();      // 创建TreeMap集合
    map_23002120.put(3, "李四");                  // 存储键和值
    map_23002120.put(2, "王五");
    map_23002120.put(4, "赵六");
    map_23002120.put(3, "张三");
    Set keySet = map_23002120.keySet();
    Iterator it = keySet.iterator();
    while (it.hasNext()) {
        Object key = it.next();
        Object value = map_23002120.get(key); // 获取每个键所对应的值
        System.out.println(key+":"+value);
    }
}
}
